package g;

import javax.annotation.Nullable;

/* compiled from: SegmentPool */
public final class w {
    @Nullable
    public static v a;
    public static long b;

    public static void a(v vVar) {
        if (vVar.f != null || vVar.g != null) {
            throw new IllegalArgumentException();
        } else if (!vVar.d) {
            synchronized (w.class) {
                long j = b + 8192;
                if (j > 65536) {
                    return;
                }
                b = j;
                vVar.f = a;
                vVar.c = 0;
                vVar.b = 0;
                a = vVar;
            }
        }
    }

    public static v b() {
        synchronized (w.class) {
            v vVar = a;
            if (vVar != null) {
                a = vVar.f;
                vVar.f = null;
                b -= 8192;
                return vVar;
            }
            return new v();
        }
    }
}
